package com.flute.tools.xml.xpath;

import com.flute.tools.xml.XmlNode;

public class NormalMultiPathParser implements IMultiPathParser {

	@Override
	public void parse(PathValuePair[] pairs, XmlNode parent) {
		if (pairs.length > 0) {
			if (pairs[0].getPathNode() instanceof GroupElementPathNode) {
				GroupElementPathNode node = (GroupElementPathNode) pairs[0]
						.getPathNode();
				parent = PathParsers.getInstance().parse(node.getGroup(), null,
						parent);
				for (PathValuePair pair : pairs) {

					PathParsers.getInstance().parse(
							((GroupElementPathNode) pair.getPathNode())
									.getPathNode(), pair.getValue(), parent);
				}
			}
		}
	}
}
